blob: d3c95e00ae93d78f85e9e6e62983b49cc73b760e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<script>
import AppHeader from "$comp/AppHeader.svelte";
import { getDecodedToken } from "@cashu/cashu-ts";
import { copy, sats, f, s } from "$lib/utils";
import { t } from "$lib/translations";
import Icon from "$comp/Icon.svelte";
export let data;
let { id, rates, user, token, total, spent, external, mint } = data;
let currency = user?.currency || "USD";
let rate = rates[currency];
let amount = total - spent;
$: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2));
$: spentFiat = parseFloat(((spent * rate) / sats).toFixed(2));
</script>
<div class="container px-4 max-w-lg mx-auto space-y-5 mt-20">
<h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">
{$t("payments.ecash")}
</h1>
{#if amount > 0}
<div class="text-center font-bold text-2xl">
<div>
{f(amountFiat, currency)}
</div>
<div>
<span class="text-secondary font-normal text-xl"
>⚡️{`${s(amount)}`}</span
>
</div>
</div>
{/if}
{#if spent > 0}
<div class="text-center font-bold text-2xl">
<div>
{f(spentFiat, currency)}
<span class=" text-red-600">{$t("payments.spent")}</span>
</div>
<div>
<span class="text-secondary font-normal text-xl"
>⚡️{`${s(spent)}`}</span
>
</div>
</div>
{/if}
<slot />
</div>
|